package com.csp.mingyue.system.api.feign;

import com.csp.mingyue.common.core.constant.ServiceNameConstants;
import com.csp.mingyue.common.core.vo.R;
import com.csp.mingyue.system.api.entity.SysUser;
import com.csp.mingyue.system.api.vo.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * 远程调用用户服务
 *
 * @author njy
 * @date 2023/7/3 09:48
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE)
public interface RemoteUserService {

	/**
	 * 通过用户名查询用户、角色信息
	 * @param username 用户名
	 * @return R
	 */
	@GetMapping(value = "/sysUser/info/{username}")
	R<LoginUser> userInfo(@PathVariable("username") String username);

	/**
	 * 通过电话查询用户、角色信息
	 * @param phone 手机号
	 * @return R
	 */
	@GetMapping(value = "/sysUser/infoByPhone/{phone}")
	R<LoginUser> userInfoByPhone(@PathVariable("phone") String phone);

	/**
	 * 通过邮箱查询用户、角色信息
	 * @param email 邮箱
	 * @return R
	 */
	@GetMapping(value = "/sysUser/infoByEmail/{email}")
	R<LoginUser> userInfoByEmail(@PathVariable("email") String email);

	/**
	 * 用户注册
	 * @param sysUser 系统用户
	 * @return
	 */
	@PostMapping(value = "/sysUser/register")
	R<Boolean> register(SysUser sysUser);

}
